package cn.elricyu.tt.bean.train;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class Trainers {
	private int wuhun;
	private int totalcost;
	private int totalgoldcost;
	private int gold;
	private Map<String, Trainer> trainerMap = new HashMap<String, Trainer>();

	public int getWuhun() {
		return wuhun;
	}

	public void setWuhun(int wuhun) {
		this.wuhun = wuhun;
	}

	public int getTotalcost() {
		return totalcost;
	}

	public void setTotalcost(int totalcost) {
		this.totalcost = totalcost;
	}

	public int getTotalgoldcost() {
		return totalgoldcost;
	}

	public void setTotalgoldcost(int totalgoldcost) {
		this.totalgoldcost = totalgoldcost;
	}

	public int getGold() {
		return gold;
	}

	public void setGold(int gold) {
		this.gold = gold;
	}

	public Map<String, Trainer> getTrainerMap() {
		return trainerMap;
	}

	public Trainer getTrainer(String name) {
		return trainerMap.get(name);
	}

	public void addTrainer(Trainer trainer) {
		trainerMap.put(trainer.getName(), trainer);
	}

	public List<Trainer> getTrainerList() {
		List<Trainer> trainerList = new ArrayList<Trainer>();
		trainerList.addAll(trainerMap.values());
		return trainerList;
	}

	public List<Trainer> getCanOpenTrainerList(int maxLevel) {
		List<Trainer> trainerList = new ArrayList<Trainer>();
		for (Trainer trainer : trainerMap.values()) {
			if (trainer.getLvlimit() <= maxLevel) {
				trainerList.add(trainer);
			}
		}
		return trainerList;
	}

}
